package com.snda.storage.service.sdk;


/**
 * 
 * @author wangzijian@snda.com
 * 
 */
public enum Location {

	BEIJING("beijing-storage.grandcloud.cn"), 
	WUXI("storage.grandcloud.cn");
	
	public static final Location DEFAULT = WUXI;
	
	private final String host;
	
	private Location(String host) {
		this.host = host;
	}

	public String getHost() {
		return host;
	}

	@Override
	public String toString() {
		return name().toLowerCase();
	}

	public static Location parse(String text) {
		if (text == null) {
			return null;
		}
		return valueOf(text.toUpperCase());
	}
	
	public static Location nullToDefault(Location location) {
		return location == null ? DEFAULT : location;
	}
	
	public static Location defaultToNull(Location location) {
		return location == DEFAULT ? null : location;
	}
}
